"""
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
@Project : autotest
@File : yaml_config.py
@Author : zjx
@Time : 2022/12/11 21:17

"""
import os

import yaml

from constants import YAML_PATH


class GetConfig:

    def __init__(self):
        yaml_path = os.path.join(YAML_PATH, 'environment.yaml')
        with open(yaml_path, 'r', encoding='utf-8') as f:
            self.env = yaml.load(f, Loader=yaml.FullLoader)

    def get_username_password(self, user):
        # return self.env['username'], self.env['password']
        return self.env['user'][user]['username'], self.env['user'][user]['password']

    def get_url(self):
        return self.env['url']


# if __name__ == '__main__':
#     print(GetConfig().get_username_password('jay'))
